namespace QMVnSoft.Lists
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormDmKsEditor : FormListEditor
    {
        private IContainer components;
        private LabelControl lblDesc_EN;
        private LabelControl lblDien_Giai;
        private LabelControl lblStt0;
        private LabelControl lblTk_Den;
        private LabelControl lblTk_Di;
        private TextControl txtDesc_EN;
        private TextControl txtDien_Giai;
        private TextControl txtStt0;
        private TextControl txtTen_Tk_Den;
        private TextControl txtTen_Tk_Di;
        private TextSearch txtTk_Den;
        private TextSearch txtTk_Di;

        public FormDmKsEditor()
        {
            this.InitializeComponent();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormDmKsEditor));
            this.lblTk_Di = new QMVnSoft.Controls.LabelControl();
            this.txtTen_Tk_Di = new QMVnSoft.Controls.TextControl();
            this.txtTk_Di = new QMVnSoft.Controls.TextSearch();
            this.lblDesc_EN = new QMVnSoft.Controls.LabelControl();
            this.lblDien_Giai = new QMVnSoft.Controls.LabelControl();
            this.txtDesc_EN = new QMVnSoft.Controls.TextControl();
            this.txtDien_Giai = new QMVnSoft.Controls.TextControl();
            this.txtTk_Den = new QMVnSoft.Controls.TextSearch();
            this.txtTen_Tk_Den = new QMVnSoft.Controls.TextControl();
            this.lblTk_Den = new QMVnSoft.Controls.LabelControl();
            this.txtStt0 = new QMVnSoft.Controls.TextControl();
            this.lblStt0 = new QMVnSoft.Controls.LabelControl();
            this.SuspendLayout();
            // 
            // lblPhan_Loai
            // 
            this.lblPhan_Loai.Location = new System.Drawing.Point(12, 148);
            // 
            // txtMa_Loai1
            // 
            this.txtMa_Loai1.Location = new System.Drawing.Point(123, 145);
            // 
            // txtMa_Loai2
            // 
            this.txtMa_Loai2.Location = new System.Drawing.Point(251, 145);
            // 
            // txtMa_Loai3
            // 
            this.txtMa_Loai3.Location = new System.Drawing.Point(379, 145);
            // 
            // lblTk_Di
            // 
            this.lblTk_Di.AutoSize = true;
            this.lblTk_Di.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTk_Di.Location = new System.Drawing.Point(9, 52);
            this.lblTk_Di.Name = "lblTk_Di";
            this.lblTk_Di.Size = new System.Drawing.Size(66, 14);
            this.lblTk_Di.TabIndex = 83;
            this.lblTk_Di.Text = "Từ tài khoản";
            // 
            // txtTen_Tk_Di
            // 
            this.txtTen_Tk_Di.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Tk_Di.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Tk_Di.CheckTextSearched = false;
            this.txtTen_Tk_Di.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk_Di.Enabled = false;
            this.txtTen_Tk_Di.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Tk_Di.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk_Di.Location = new System.Drawing.Point(214, 52);
            this.txtTen_Tk_Di.Name = "txtTen_Tk_Di";
            this.txtTen_Tk_Di.OldValue = null;
            this.txtTen_Tk_Di.Size = new System.Drawing.Size(326, 13);
            this.txtTen_Tk_Di.TabIndex = 85;
            this.txtTen_Tk_Di.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Tk_Di.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Tk_Di.Value = ((object)(resources.GetObject("txtTen_Tk_Di.Value")));
            // 
            // txtTk_Di
            // 
            this.txtTk_Di.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtTk_Di.CheckTextSearched = false;
            this.txtTk_Di.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTk_Di.FieldDisplay = "Ten_Tk";
            this.txtTk_Di.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTk_Di.Location = new System.Drawing.Point(97, 49);
            this.txtTk_Di.MaxLength = 32;
            this.txtTk_Di.Name = "txtTk_Di";
            this.txtTk_Di.OldValue = null;
            this.txtTk_Di.Size = new System.Drawing.Size(111, 20);
            this.txtTk_Di.TabIndex = 1;
            this.txtTk_Di.TableName = "DMTK";
            this.txtTk_Di.TextDisplay = this.txtTen_Tk_Di;
            this.txtTk_Di.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtTk_Di.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtTk_Di.Value = ((object)(resources.GetObject("txtTk_Di.Value")));
            // 
            // lblDesc_EN
            // 
            this.lblDesc_EN.AutoSize = true;
            this.lblDesc_EN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDesc_EN.Location = new System.Drawing.Point(9, 94);
            this.lblDesc_EN.Name = "lblDesc_EN";
            this.lblDesc_EN.Size = new System.Drawing.Size(71, 14);
            this.lblDesc_EN.TabIndex = 89;
            this.lblDesc_EN.Text = "Diễn giải (EN)";
            // 
            // lblDien_Giai
            // 
            this.lblDien_Giai.AutoSize = true;
            this.lblDien_Giai.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDien_Giai.Location = new System.Drawing.Point(9, 73);
            this.lblDien_Giai.Name = "lblDien_Giai";
            this.lblDien_Giai.Size = new System.Drawing.Size(73, 14);
            this.lblDien_Giai.TabIndex = 90;
            this.lblDien_Giai.Text = "Diễn giải (VN)";
            // 
            // txtDesc_EN
            // 
            this.txtDesc_EN.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtDesc_EN.CheckTextSearched = false;
            this.txtDesc_EN.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtDesc_EN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDesc_EN.Location = new System.Drawing.Point(97, 91);
            this.txtDesc_EN.MaxLength = 128;
            this.txtDesc_EN.Name = "txtDesc_EN";
            this.txtDesc_EN.OldValue = null;
            this.txtDesc_EN.Size = new System.Drawing.Size(443, 20);
            this.txtDesc_EN.TabIndex = 3;
            this.txtDesc_EN.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtDesc_EN.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtDesc_EN.Value = ((object)(resources.GetObject("txtDesc_EN.Value")));
            // 
            // txtDien_Giai
            // 
            this.txtDien_Giai.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtDien_Giai.CheckTextSearched = false;
            this.txtDien_Giai.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtDien_Giai.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDien_Giai.Location = new System.Drawing.Point(97, 70);
            this.txtDien_Giai.MaxLength = 128;
            this.txtDien_Giai.Name = "txtDien_Giai";
            this.txtDien_Giai.OldValue = null;
            this.txtDien_Giai.Size = new System.Drawing.Size(443, 20);
            this.txtDien_Giai.TabIndex = 2;
            this.txtDien_Giai.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtDien_Giai.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtDien_Giai.Value = ((object)(resources.GetObject("txtDien_Giai.Value")));
            // 
            // txtTk_Den
            // 
            this.txtTk_Den.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtTk_Den.CheckTextSearched = false;
            this.txtTk_Den.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTk_Den.FieldDisplay = "Ten_Tk";
            this.txtTk_Den.FirstFilter = "Loai_Tk = \'C\'";
            this.txtTk_Den.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTk_Den.Location = new System.Drawing.Point(97, 112);
            this.txtTk_Den.MaxLength = 32;
            this.txtTk_Den.Name = "txtTk_Den";
            this.txtTk_Den.OldValue = null;
            this.txtTk_Den.Size = new System.Drawing.Size(111, 20);
            this.txtTk_Den.TabIndex = 4;
            this.txtTk_Den.TableName = "DMTK";
            this.txtTk_Den.TextDisplay = this.txtTen_Tk_Den;
            this.txtTk_Den.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtTk_Den.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtTk_Den.Value = ((object)(resources.GetObject("txtTk_Den.Value")));
            // 
            // txtTen_Tk_Den
            // 
            this.txtTen_Tk_Den.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Tk_Den.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Tk_Den.CheckTextSearched = false;
            this.txtTen_Tk_Den.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk_Den.Enabled = false;
            this.txtTen_Tk_Den.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Tk_Den.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk_Den.Location = new System.Drawing.Point(214, 115);
            this.txtTen_Tk_Den.Name = "txtTen_Tk_Den";
            this.txtTen_Tk_Den.OldValue = null;
            this.txtTen_Tk_Den.Size = new System.Drawing.Size(326, 13);
            this.txtTen_Tk_Den.TabIndex = 85;
            this.txtTen_Tk_Den.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Tk_Den.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Tk_Den.Value = ((object)(resources.GetObject("txtTen_Tk_Den.Value")));
            // 
            // lblTk_Den
            // 
            this.lblTk_Den.AutoSize = true;
            this.lblTk_Den.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTk_Den.Location = new System.Drawing.Point(9, 115);
            this.lblTk_Den.Name = "lblTk_Den";
            this.lblTk_Den.Size = new System.Drawing.Size(73, 14);
            this.lblTk_Den.TabIndex = 83;
            this.lblTk_Den.Text = "Đến tài khoản";
            // 
            // txtStt0
            // 
            this.txtStt0.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtStt0.CheckTextSearched = false;
            this.txtStt0.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtStt0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtStt0.Location = new System.Drawing.Point(97, 28);
            this.txtStt0.MaxLength = 20;
            this.txtStt0.Name = "txtStt0";
            this.txtStt0.OldValue = null;
            this.txtStt0.Size = new System.Drawing.Size(111, 20);
            this.txtStt0.TabIndex = 0;
            this.txtStt0.UserTextLength = QMVnSoft.AppInstance.TextControlLength.InvoiceNumber;
            this.txtStt0.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtStt0.Value = ((object)(resources.GetObject("txtStt0.Value")));
            // 
            // lblStt0
            // 
            this.lblStt0.AutoSize = true;
            this.lblStt0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblStt0.Location = new System.Drawing.Point(9, 31);
            this.lblStt0.Name = "lblStt0";
            this.lblStt0.Size = new System.Drawing.Size(52, 14);
            this.lblStt0.TabIndex = 83;
            this.lblStt0.Text = "Số thứ tự";
            // 
            // FormDmKsEditor
            // 
            this.AddTitleText = "Thêm bút toán khóa sổ";
            this.ClientSize = new System.Drawing.Size(552, 179);
            this.Controls.Add(this.txtStt0);
            this.Controls.Add(this.lblDesc_EN);
            this.Controls.Add(this.lblDien_Giai);
            this.Controls.Add(this.txtDesc_EN);
            this.Controls.Add(this.txtDien_Giai);
            this.Controls.Add(this.lblTk_Den);
            this.Controls.Add(this.lblStt0);
            this.Controls.Add(this.lblTk_Di);
            this.Controls.Add(this.txtTen_Tk_Den);
            this.Controls.Add(this.txtTen_Tk_Di);
            this.Controls.Add(this.txtTk_Den);
            this.Controls.Add(this.txtTk_Di);
            this.EditTitleText = "Sửa bút toán khóa sổ";
            this.Name = "FormDmKsEditor";
            this.ShowFreeFields = false;
            this.Text = "Thêm bút toán khóa sổ";
            this.Controls.SetChildIndex(this.lblPhan_Loai, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai1, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai2, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai3, 0);
            this.Controls.SetChildIndex(this.txtTk_Di, 0);
            this.Controls.SetChildIndex(this.txtTk_Den, 0);
            this.Controls.SetChildIndex(this.txtTen_Tk_Di, 0);
            this.Controls.SetChildIndex(this.txtTen_Tk_Den, 0);
            this.Controls.SetChildIndex(this.lblTk_Di, 0);
            this.Controls.SetChildIndex(this.lblStt0, 0);
            this.Controls.SetChildIndex(this.lblTk_Den, 0);
            this.Controls.SetChildIndex(this.txtDien_Giai, 0);
            this.Controls.SetChildIndex(this.txtDesc_EN, 0);
            this.Controls.SetChildIndex(this.lblDien_Giai, 0);
            this.Controls.SetChildIndex(this.lblDesc_EN, 0);
            this.Controls.SetChildIndex(this.txtStt0, 0);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        public override bool OnSave()
        {
            DataRow localCurrentRow;
            if (string.IsNullOrEmpty(this.txtTk_Di.Text) || string.IsNullOrEmpty(this.txtTk_Den.Text))
            {
                MessageBox.Show("Chưa nhập tài khoản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (base.NewChecked)
            {
                localCurrentRow = base.LocalTable.NewRow();
            }
            else
            {
                localCurrentRow = base.LocalCurrentRow;
            }
            localCurrentRow["Stt0"] = this.txtStt0.Value;
            localCurrentRow["Tk_Di"] = this.txtTk_Di.Value;
            localCurrentRow["Ten_Tk_Di"] = this.txtTen_Tk_Di.Value;
            localCurrentRow["Dien_Giai"] = this.txtDien_Giai.Value;
            localCurrentRow["Desc_EN"] = this.txtDesc_EN.Value;
            localCurrentRow["Tk_Den"] = this.txtTk_Den.Value;
            localCurrentRow["Ten_Tk_Den"] = this.txtTen_Tk_Den.Value;
            DmKsDataAccess access = new DmKsDataAccess();
            if (base.ShowMessage(localCurrentRow, access.SaveRow(base.NewChecked, localCurrentRow)))
            {
                return false;
            }
            if (base.NewChecked)
            {
                base.LocalTable.Rows.Add(localCurrentRow);
            }
            base.LocalCurrentRow = localCurrentRow;
            base.LocalTable.AcceptChanges();
            this.txtStt0.Focus();
            return base.OnSave();
        }

        public override void OnShow()
        {
            this.txtStt0.Value = base.LocalCurrentRow["Stt0"];
            this.txtTk_Di.Value = base.LocalCurrentRow["Tk_Di"];
            this.txtTen_Tk_Di.Value = base.LocalCurrentRow["Ten_Tk_Di"];
            this.txtDien_Giai.Value = base.LocalCurrentRow["Dien_Giai"];
            this.txtDesc_EN.Value = base.LocalCurrentRow["Desc_EN"];
            this.txtTk_Den.Value = base.LocalCurrentRow["Tk_Den"];
            this.txtTen_Tk_Den.Value = base.LocalCurrentRow["Ten_Tk_Den"];
            base.OnShow();
        }
    }
}

